Optimal. Leaf size=136 \[ h x-\frac {(d+f-2 h) \tan ^{-1}\left (\frac {1-2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(d+f-2 h) \tan ^{-1}\left (\frac {1+2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(2 e-g) \tan ^{-1}\left (\frac {1+2 x^2}{\sqrt {3}}\right )}{2 \sqrt {3}}-\frac {1}{4} (d-f) \log \left (1-x+x^2\right )+\frac {1}{4} (d-f) \log \left (1+x+x^2\right )+\frac {1}{4} g \log \left (1+x^2+x^4\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 136, normalized size of antiderivative = 1.00, number of steps
used = 17, number of rules used = 8, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.258, Rules used = {1687, 1690,
1183, 648, 632, 210, 642, 1261} \begin {gather*} -\frac {\text {ArcTan}\left (\frac {1-2 x}{\sqrt {3}}\right ) (d+f-2 h)}{2 \sqrt {3}}+\frac {\text {ArcTan}\left (\frac {2 x+1}{\sqrt {3}}\right ) (d+f-2 h)}{2 \sqrt {3}}+\frac {\text {ArcTan}\left (\frac {2 x^2+1}{\sqrt {3}}\right ) (2 e-g)}{2 \sqrt {3}}-\frac {1}{4} (d-f) \log \left (x^2-x+1\right )+\frac {1}{4} (d-f) \log \left (x^2+x+1\right )+\frac {1}{4} g \log \left (x^4+x^2+1\right )+h x \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 210
Rule 632
Rule 642
Rule 648
Rule 1183
Rule 1261
Rule 1687
Rule 1690
Rubi steps
\begin {align*} \int \frac {d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx &=\int \frac {x \left (e+g x^2\right )}{1+x^2+x^4} \, dx+\int \frac {d+f x^2+h x^4}{1+x^2+x^4} \, dx\\ &=\frac {1}{2} \text {Subst}\left (\int \frac {e+g x}{1+x+x^2} \, dx,x,x^2\right )+\int \left (h+\frac {d-h+(f-h) x^2}{1+x^2+x^4}\right ) \, dx\\ &=h x+\frac {1}{4} (2 e-g) \text {Subst}\left (\int \frac {1}{1+x+x^2} \, dx,x,x^2\right )+\frac {1}{4} g \text {Subst}\left (\int \frac {1+2 x}{1+x+x^2} \, dx,x,x^2\right )+\int \frac {d-h+(f-h) x^2}{1+x^2+x^4} \, dx\\ &=h x+\frac {1}{4} g \log \left (1+x^2+x^4\right )+\frac {1}{2} \int \frac {d-h-(d-f) x}{1-x+x^2} \, dx+\frac {1}{2} \int \frac {d-h+(d-f) x}{1+x+x^2} \, dx+\frac {1}{2} (-2 e+g) \text {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,1+2 x^2\right )\\ &=h x+\frac {(2 e-g) \tan ^{-1}\left (\frac {1+2 x^2}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {1}{4} g \log \left (1+x^2+x^4\right )+\frac {1}{4} (d-f) \int \frac {1+2 x}{1+x+x^2} \, dx+\frac {1}{4} (-d+f) \int \frac {-1+2 x}{1-x+x^2} \, dx+\frac {1}{4} (d+f-2 h) \int \frac {1}{1-x+x^2} \, dx+\frac {1}{4} (d+f-2 h) \int \frac {1}{1+x+x^2} \, dx\\ &=h x+\frac {(2 e-g) \tan ^{-1}\left (\frac {1+2 x^2}{\sqrt {3}}\right )}{2 \sqrt {3}}-\frac {1}{4} (d-f) \log \left (1-x+x^2\right )+\frac {1}{4} (d-f) \log \left (1+x+x^2\right )+\frac {1}{4} g \log \left (1+x^2+x^4\right )+\frac {1}{2} (-d-f+2 h) \text {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,-1+2 x\right )+\frac {1}{2} (-d-f+2 h) \text {Subst}\left (\int \frac {1}{-3-x^2} \, dx,x,1+2 x\right )\\ &=h x-\frac {(d+f-2 h) \tan ^{-1}\left (\frac {1-2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(d+f-2 h) \tan ^{-1}\left (\frac {1+2 x}{\sqrt {3}}\right )}{2 \sqrt {3}}+\frac {(2 e-g) \tan ^{-1}\left (\frac {1+2 x^2}{\sqrt {3}}\right )}{2 \sqrt {3}}-\frac {1}{4} (d-f) \log \left (1-x+x^2\right )+\frac {1}{4} (d-f) \log \left (1+x+x^2\right )+\frac {1}{4} g \log \left (1+x^2+x^4\right )\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.38, size = 165, normalized size = 1.21 \begin {gather*} \frac {1}{24} \left (24 h x+4 \left (\left (3 i+\sqrt {3}\right ) d+\left (-3 i+\sqrt {3}\right ) f-2 \sqrt {3} h\right ) \tan ^{-1}\left (\frac {1}{2} \left (-i+\sqrt {3}\right ) x\right )+4 \left (\left (-3 i+\sqrt {3}\right ) d+\left (3 i+\sqrt {3}\right ) f-2 \sqrt {3} h\right ) \tan ^{-1}\left (\frac {1}{2} \left (i+\sqrt {3}\right ) x\right )-8 \sqrt {3} e \tan ^{-1}\left (\frac {\sqrt {3}}{1+2 x^2}\right )+4 \sqrt {3} g \tan ^{-1}\left (\frac {\sqrt {3}}{1+2 x^2}\right )+6 g \log \left (1+x^2+x^4\right )\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.18, size = 99, normalized size = 0.73
method | result | size |
default | \(h x +\frac {\left (d -f +g \right ) \ln \left (x^{2}+x +1\right )}{4}+\frac {\left (\frac {d}{2}-e +\frac {f}{2}+\frac {g}{2}-h \right ) \arctan \left (\frac {\left (2 x +1\right ) \sqrt {3}}{3}\right ) \sqrt {3}}{3}+\frac {\left (f -d +g \right ) \ln \left (x^{2}-x +1\right )}{4}+\frac {\left (\frac {d}{2}+e +\frac {f}{2}-\frac {g}{2}-h \right ) \sqrt {3}\, \arctan \left (\frac {\left (2 x -1\right ) \sqrt {3}}{3}\right )}{3}\) | \(99\) |
risch | \(\text {Expression too large to display}\) | \(140079\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.50, size = 94, normalized size = 0.69 \begin {gather*} \frac {1}{6} \, \sqrt {3} {\left (d + f + g - 2 \, h - 2 \, e\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{6} \, \sqrt {3} {\left (d + f - g - 2 \, h + 2 \, e\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + h x + \frac {1}{4} \, {\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{4} \, {\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.27, size = 92, normalized size = 0.68 \begin {gather*} \frac {1}{6} \, \sqrt {3} {\left (d - 2 \, e + f + g - 2 \, h\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{6} \, \sqrt {3} {\left (d + 2 \, e + f - g - 2 \, h\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + h x + \frac {1}{4} \, {\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{4} \, {\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 4.73, size = 94, normalized size = 0.69 \begin {gather*} \frac {1}{6} \, \sqrt {3} {\left (d + f + g - 2 \, h - 2 \, e\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x + 1\right )}\right ) + \frac {1}{6} \, \sqrt {3} {\left (d + f - g - 2 \, h + 2 \, e\right )} \arctan \left (\frac {1}{3} \, \sqrt {3} {\left (2 \, x - 1\right )}\right ) + h x + \frac {1}{4} \, {\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac {1}{4} \, {\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.11, size = 1209, normalized size = 8.89 \begin {gather*} h\,x+\ln \left (2\,\sqrt {3}\,d\,e-3\,\sqrt {3}\,d^2+3\,\sqrt {3}\,d\,f-\sqrt {3}\,d\,g-4\,\sqrt {3}\,e\,f+3\,\sqrt {3}\,d\,h+2\,\sqrt {3}\,e\,h+2\,\sqrt {3}\,f\,g-3\,\sqrt {3}\,f\,h-\sqrt {3}\,g\,h+3\,\sqrt {3}\,f^2\,x-3\,\sqrt {3}\,d\,f\,x-2\,\sqrt {3}\,d\,g\,x-2\,\sqrt {3}\,e\,f\,x+3\,\sqrt {3}\,d\,h\,x-2\,\sqrt {3}\,e\,h\,x+\sqrt {3}\,f\,g\,x-3\,\sqrt {3}\,f\,h\,x+\sqrt {3}\,g\,h\,x+4\,\sqrt {3}\,d\,e\,x-d\,e\,6{}\mathrm {i}+d\,f\,9{}\mathrm {i}+d\,g\,3{}\mathrm {i}-d\,h\,3{}\mathrm {i}+e\,h\,6{}\mathrm {i}+f\,h\,3{}\mathrm {i}-g\,h\,3{}\mathrm {i}-d^2\,x\,6{}\mathrm {i}-f^2\,x\,3{}\mathrm {i}-d^2\,3{}\mathrm {i}-f^2\,6{}\mathrm {i}+d\,f\,x\,9{}\mathrm {i}-e\,f\,x\,6{}\mathrm {i}+d\,h\,x\,3{}\mathrm {i}+e\,h\,x\,6{}\mathrm {i}+f\,g\,x\,3{}\mathrm {i}-f\,h\,x\,3{}\mathrm {i}-g\,h\,x\,3{}\mathrm {i}\right )\,\left (\frac {d}{4}-\frac {f}{4}+\frac {g}{4}-\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{12}+\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{6}-\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{12}+\frac {\sqrt {3}\,h\,1{}\mathrm {i}}{6}\right )+\ln \left (3\,\sqrt {3}\,d^2-2\,\sqrt {3}\,d\,e-3\,\sqrt {3}\,d\,f+\sqrt {3}\,d\,g+4\,\sqrt {3}\,e\,f-3\,\sqrt {3}\,d\,h-2\,\sqrt {3}\,e\,h-2\,\sqrt {3}\,f\,g+3\,\sqrt {3}\,f\,h+\sqrt {3}\,g\,h-3\,\sqrt {3}\,f^2\,x+3\,\sqrt {3}\,d\,f\,x+2\,\sqrt {3}\,d\,g\,x+2\,\sqrt {3}\,e\,f\,x-3\,\sqrt {3}\,d\,h\,x+2\,\sqrt {3}\,e\,h\,x-\sqrt {3}\,f\,g\,x+3\,\sqrt {3}\,f\,h\,x-\sqrt {3}\,g\,h\,x-4\,\sqrt {3}\,d\,e\,x-d\,e\,6{}\mathrm {i}+d\,f\,9{}\mathrm {i}+d\,g\,3{}\mathrm {i}-d\,h\,3{}\mathrm {i}+e\,h\,6{}\mathrm {i}+f\,h\,3{}\mathrm {i}-g\,h\,3{}\mathrm {i}-d^2\,x\,6{}\mathrm {i}-f^2\,x\,3{}\mathrm {i}-d^2\,3{}\mathrm {i}-f^2\,6{}\mathrm {i}+d\,f\,x\,9{}\mathrm {i}-e\,f\,x\,6{}\mathrm {i}+d\,h\,x\,3{}\mathrm {i}+e\,h\,x\,6{}\mathrm {i}+f\,g\,x\,3{}\mathrm {i}-f\,h\,x\,3{}\mathrm {i}-g\,h\,x\,3{}\mathrm {i}\right )\,\left (\frac {d}{4}-\frac {f}{4}+\frac {g}{4}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{6}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{12}+\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,h\,1{}\mathrm {i}}{6}\right )+\ln \left (3\,\sqrt {3}\,d^2+2\,\sqrt {3}\,d\,e-3\,\sqrt {3}\,d\,f-\sqrt {3}\,d\,g-4\,\sqrt {3}\,e\,f-3\,\sqrt {3}\,d\,h+2\,\sqrt {3}\,e\,h+2\,\sqrt {3}\,f\,g+3\,\sqrt {3}\,f\,h-\sqrt {3}\,g\,h+3\,\sqrt {3}\,f^2\,x-3\,\sqrt {3}\,d\,f\,x+2\,\sqrt {3}\,d\,g\,x+2\,\sqrt {3}\,e\,f\,x+3\,\sqrt {3}\,d\,h\,x+2\,\sqrt {3}\,e\,h\,x-\sqrt {3}\,f\,g\,x-3\,\sqrt {3}\,f\,h\,x-\sqrt {3}\,g\,h\,x-4\,\sqrt {3}\,d\,e\,x-d\,e\,6{}\mathrm {i}-d\,f\,9{}\mathrm {i}+d\,g\,3{}\mathrm {i}+d\,h\,3{}\mathrm {i}+e\,h\,6{}\mathrm {i}-f\,h\,3{}\mathrm {i}-g\,h\,3{}\mathrm {i}-d^2\,x\,6{}\mathrm {i}-f^2\,x\,3{}\mathrm {i}+d^2\,3{}\mathrm {i}+f^2\,6{}\mathrm {i}+d\,f\,x\,9{}\mathrm {i}+e\,f\,x\,6{}\mathrm {i}+d\,h\,x\,3{}\mathrm {i}-e\,h\,x\,6{}\mathrm {i}-f\,g\,x\,3{}\mathrm {i}-f\,h\,x\,3{}\mathrm {i}+g\,h\,x\,3{}\mathrm {i}\right )\,\left (\frac {f}{4}-\frac {d}{4}+\frac {g}{4}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{12}+\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{6}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,h\,1{}\mathrm {i}}{6}\right )-\ln \left (3\,\sqrt {3}\,d\,f-2\,\sqrt {3}\,d\,e-3\,\sqrt {3}\,d^2+\sqrt {3}\,d\,g+4\,\sqrt {3}\,e\,f+3\,\sqrt {3}\,d\,h-2\,\sqrt {3}\,e\,h-2\,\sqrt {3}\,f\,g-3\,\sqrt {3}\,f\,h+\sqrt {3}\,g\,h-3\,\sqrt {3}\,f^2\,x+3\,\sqrt {3}\,d\,f\,x-2\,\sqrt {3}\,d\,g\,x-2\,\sqrt {3}\,e\,f\,x-3\,\sqrt {3}\,d\,h\,x-2\,\sqrt {3}\,e\,h\,x+\sqrt {3}\,f\,g\,x+3\,\sqrt {3}\,f\,h\,x+\sqrt {3}\,g\,h\,x+4\,\sqrt {3}\,d\,e\,x-d\,e\,6{}\mathrm {i}-d\,f\,9{}\mathrm {i}+d\,g\,3{}\mathrm {i}+d\,h\,3{}\mathrm {i}+e\,h\,6{}\mathrm {i}-f\,h\,3{}\mathrm {i}-g\,h\,3{}\mathrm {i}-d^2\,x\,6{}\mathrm {i}-f^2\,x\,3{}\mathrm {i}+d^2\,3{}\mathrm {i}+f^2\,6{}\mathrm {i}+d\,f\,x\,9{}\mathrm {i}+e\,f\,x\,6{}\mathrm {i}+d\,h\,x\,3{}\mathrm {i}-e\,h\,x\,6{}\mathrm {i}-f\,g\,x\,3{}\mathrm {i}-f\,h\,x\,3{}\mathrm {i}+g\,h\,x\,3{}\mathrm {i}\right )\,\left (\frac {d}{4}-\frac {f}{4}-\frac {g}{4}+\frac {\sqrt {3}\,d\,1{}\mathrm {i}}{12}+\frac {\sqrt {3}\,e\,1{}\mathrm {i}}{6}+\frac {\sqrt {3}\,f\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,g\,1{}\mathrm {i}}{12}-\frac {\sqrt {3}\,h\,1{}\mathrm {i}}{6}\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________